package com.czm.art_light.controller;

import com.czm.art_light.constant.ApiRouterConsts;
import com.czm.art_light.param.request.ArtUserFeedbackReqDto;
import com.czm.art_light.param.response.ArtUserFeedbackRespDto;
import com.czm.art_light.param.response.RestResp;
import com.czm.art_light.service.ArtUserFeedbackService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 反馈内容信息 API 控制器
 */
@Tag(name = "反馈内容信息管理", description = "反馈内容信息相关接口")
@RestController
@RequestMapping(ApiRouterConsts.FEEDBACK_API_URL_PREFIX)
public class ArtUserFeedbackController {
    @Autowired
    private ArtUserFeedbackService artUserFeedbackService;
    /**
     * 添加反馈的内容
     */
    @Operation(summary = "添加反馈的内容")
    @PostMapping("/add")
    public RestResp<Void> addFeedback(@RequestBody ArtUserFeedbackReqDto artUserFeedbackReqDto) {
        artUserFeedbackService.addFeedback(artUserFeedbackReqDto);
        return RestResp.ok();
    }

    /**
     * 获取当前用户的所有反馈
     */
    @Operation(summary = "获取当前用户的所有反馈")
    @GetMapping("/list")
    public RestResp<List<ArtUserFeedbackRespDto>> getFeedbackByUserId() {
        List<ArtUserFeedbackRespDto>  artUserFeedbackRespDtos = artUserFeedbackService.getFeedbackByUserId();
        return RestResp.ok(artUserFeedbackRespDtos);
    }
}
